package com.nannybear.View;

import android.widget.ImageButton;

import com.nannybear.R;

/**
 * \brief Abstract class of screen
 * \author Audrey LOISEAU
 * \date 16-03-2015
 */

/********************************* COPYRIGHT *********************************
 * Copyright (c) 2015, Audrey LOISEAU and Benjamin LANCINOT.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice, this
 *    list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *************************************************************************************/

public abstract class Screen {
    /********** DECLARATIONS **********/
    private int layout;
    private ImageButton homeButton, tempButton, remoteButton, humidityButton, babyStateButton, settingsButton, helpButton, healthButton, calendarButton;
    private int[] tempDrawable;
    private int[] humDrawable;

    /************ METHODS ************/
    /**
     * \brief Constructor
     * \param layout    The layout
     * \param isTempScreen  If the user is on the Temperature screen
     * \param isHumScreen   If the user is on the Humidity screen
     */
    Screen(int layout, boolean isTempScreen, boolean isHumScreen){
        tempDrawable = new int[3];
        humDrawable = new int[3];
        this.layout = layout;
        if (isTempScreen){
            tempDrawable [0]=R.drawable.temp_active;
            tempDrawable [1]=R.drawable.temp_active_moderate;
            tempDrawable [2]=R.drawable.temp_active_critical;

            humDrawable [0]= R.drawable.humidity_grey;
            humDrawable [1]=R.drawable.humidity_grey_moderate;
            humDrawable [2]= R.drawable.humidity_grey_critical;
        }
        else if (isHumScreen){
            tempDrawable [0]=R.drawable.temp_grey;
            tempDrawable [1]=R.drawable.temp_grey_moderate;
            tempDrawable [2]=R.drawable.temp_grey_critical;

            humDrawable [0]= R.drawable.humidity_active;
            humDrawable [1]=R.drawable.humidity_active_moderate;
            humDrawable [2]= R.drawable.humidity_active_critical;
        }
        else{
            tempDrawable [0]=R.drawable.temp_grey;
            tempDrawable [1]=R.drawable.temp_grey_moderate;
            tempDrawable [2]=R.drawable.temp_grey_critical;

            humDrawable [0]= R.drawable.humidity_grey;
            humDrawable [1]=R.drawable.humidity_grey_moderate;
            humDrawable [2]= R.drawable.humidity_grey_critical;
        }
    }

    /**
     * \brief Show the view
     * \param thresholdTemp The value of temperature threshold
     * \param thresholdHum  The value of humidity threshold
     */
    public abstract void display(int thresholdTemp,int thresholdHum);

    /**
     * \brief Close the view (empty)
     */
    public abstract void close();

    /*********** ACCESSORS ***********/
    /**
     * \brief Get method for the layout
     */
    public int getLayout() {
        return layout;
    }

    /**
     * \brief Get method for the home button
     */
    public ImageButton getHomeButton() {
        return homeButton;
    }

    /**
     * \brief Get method for the temperature button
     */
    public ImageButton getTempButton() {
        return tempButton;
    }

    /**
     * \brief Get method for the remote button
     */
    public ImageButton getRemoteButton() {
        return remoteButton;
    }

    /**
     * \brief Get method for the humidity button
     */
    public ImageButton getHumidityButton() {
        return humidityButton;
    }

    /**
     * \brief Get method for the baby state button
     */
    public ImageButton getBabyStateButton() {
        return babyStateButton;
    }

    /**
     * \brief Get method for the calendar button
     */
    public ImageButton getCalendarButton() {
        return calendarButton;
    }

    /**
     * \brief Get method for the settings button
     */
    public ImageButton getSettingsButton() {
        return settingsButton;
    }

    /**
     * \brief Get method for the help button
     */
    public ImageButton getHelpButton() {
        return helpButton;
    }

    /**
     * \brief Get method for the temperature drawable
     */
    public int[] getTempDrawable() {
        return tempDrawable;
    }

    /**
     * \brief Get method for the humidity drawable
     */
    public int[] getHumDrawable() {
        return humDrawable;
    }

    /**
     * \brief Get method for the health button
     */
    public ImageButton getHealthButton() {
        return healthButton;
    }

    /**
     * \brief Set method for the home button
     */
    public void setHomeButton(ImageButton homeButton) {
        this.homeButton = homeButton;
    }

    /**
     * \brief Set method for the temperature button
     */
    public void setTempButton(ImageButton tempButton) {
        this.tempButton = tempButton;
    }

    /**
     * \brief Set method for the brightness button
     */
    public void setBrightnessButton(ImageButton remoteButton) {
        this.remoteButton= remoteButton;
    }

    /**
     * \brief Set method for the humidity button
     */
    public void setHumidityButton(ImageButton humidityButton) {
        this.humidityButton = humidityButton;
    }

    /**
     * \brief Set method for the baby state button
     */
    public void setBabyStateButton(ImageButton babyStateButton) {
        this.babyStateButton = babyStateButton;
    }

    /**
     * \brief Set method for the settings button
     */
    public void setSettingsButton(ImageButton settingsButton) {
        this.settingsButton = settingsButton;
    }

    /**
     * \brief Set method for the help button
     */
    public void setHelpButton(ImageButton helpButton) {
        this.helpButton = helpButton;
    }

    /**
     * \brief Set method for the calendar button
     */
    public void setCalendarButton(ImageButton calendarButton) {
        this.calendarButton = calendarButton;
    }

    /**
     * \brief Set method for the health button
     */
    public void setHealthButton(ImageButton healthButton) {
        this.healthButton = healthButton;
    }
}
